﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.Crc.ResManage.DAL.EquipManage;
using Com.Crc.PoJo.Model.Resource;
using Com.Crc.ResManage.BLL.EquipManage;
using System.Data;
using System.Collections;


namespace Com.Crc.ResManage.BLL.EquipManage
{
    public class OLTManageBLL
    {
        OLTManagerDAL dal = new OLTManagerDAL();

        /// <summary>
        /// 新增OLT设备信息
        /// </summary>
        /// <param name="data">model实体</param>
        /// <returns></returns>
        public bool AddOLTData(OLTEntity data)
        {
            try
            {
                return dal.AddOLTData(data);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

        /// <summary>
        /// 修改OLT设备信息
        /// </summary>
        /// <param name="data">model实体</param>
        /// <returns></returns>
        public bool UpdateOLTData(OLTEntity data)
        {
            try
            {
                return dal.UpdateOLTData(data);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

        /// <summary>
        /// 查询OLT设备信息
        /// </summary>
        /// <param name="strBranchID">分局ID</param>
        /// <param name="strOfficeID">局点ID</param>
        /// <param name="strEquipID">设备ID</param>
        /// <returns></returns>
        public DataTable QueryOLTData(string strBranchID, string strOfficeID, string strOLTID)
        {
            try
            {
                return dal.QueryOLTData(strBranchID, strOfficeID, strOLTID);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return null;
            }
        }

        /// <summary>
        /// 删除设备，修改状态位
        /// </summary>
        /// <param name="wlanList"></param>
        /// <returns></returns>
        public bool DeleteOLTData(ArrayList oltList)
        {
            try
            {
                PONManageUserBoardDAL boardDAL = new PONManageUserBoardDAL();

                return (dal.DeleteOLTData(oltList) && boardDAL.DeletePONUserBoardDataByOLT(oltList));

            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

    }
}
